package com.yiliao.control;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yiliao.service.AlipaySetUpServvice;
import com.yiliao.service.SentenceService;
import com.yiliao.util.MessageUtil;
import com.yiliao.util.PrintUtil;

import net.sf.json.JSONObject;

@Controller
@RequestMapping("admin")
public class SentenceContror {

	@Autowired
	private SentenceService sentenceService;
	
	/**
	 * 获取语术列表
	 * @return
	 */
	@RequestMapping(value = {"getSentenceList"},method = RequestMethod.POST)
	@ResponseBody
	public JSONObject getSentenceList(int page , int size,int userId) {
		return sentenceService.getSentenceList(page,size, userId);
	}
	
	@RequestMapping("addSentence")
	@ResponseBody
	public void addSentence(Integer t_id,String userId,String t_sentence_content,String t_sentence_type,int t_sentence_time,String t_sort,String t_sentence_param,HttpServletResponse response) {
		
		MessageUtil mu = this.sentenceService.addSentence( t_id, userId, t_sentence_content, t_sentence_type, t_sentence_time, t_sort,t_sentence_param);
		
		PrintUtil.printWri(mu, response);
	}
	
	/**
	 * 删除语术设置
	 * @param t_id
	 * @param response
	 */
	@RequestMapping("delSentence")
	@ResponseBody
	public void delSentence(int t_id,HttpServletResponse response) {
		
		MessageUtil mu = this.sentenceService.delSentence(t_id);
		
		PrintUtil.printWri(mu, response);
	}
	
}
